__author__ = 'luomingzhong'
# --coding:utf-8--

import re
import sys

reload(sys)
sys.setdefaultencoding('utf8')

# setting = test or producation
# key =  testModePublicKey or  encryptPublicKey
def checkoutConfig(filename):
    f = open(filename, 'r')
    result = list()
    result2 = list()
    num = 0
    for line in open(filename):
        line = f.readline()
        string = re.search(r"producation|encryptPublicKey", line)
        if string != None:
            result.append(line)
    f.close()

    for line in result:
        string = re.search(r"//", line)
        if string == None:
            result2.append(line)

    print(result2)

    for line in result2:
        string = re.search(r"producation|encryptPublicKey", line)
        if string != None:
            print(line)
            num = num + 1

    if num >2:
        print "right config"
        return True
    else:
        print "error config"
        return False


checkoutConfig("text.js")
